package com.itheima.sc.impl.ums;

import com.itheima.sc.api.ums.ResourceCategoryApi;
import com.itheima.sc.mapper.ums.UmsResourceCategoryMapper;
import com.itheima.sc.pojo.ums.UmsResourceCategory;
import org.apache.dubbo.config.annotation.DubboService;
import org.springframework.beans.factory.annotation.Autowired;

import java.util.List;

@DubboService
public class UmsResourceCategoryServiceImpl implements ResourceCategoryApi {
    @Autowired
    private UmsResourceCategoryMapper umsResourceCategoryMapper;

    /**
     * 添加后台资源分类
     */
    @Override
    public void create(UmsResourceCategory umsResourceCategory) {
        umsResourceCategoryMapper.insert(umsResourceCategory);
    }

    /**
     * 根据ID删除后台资源
     */
    @Override
    public void delete(Integer id) {
        umsResourceCategoryMapper.deleteById(id);
    }

    /**
     * 查询所有后台资源分类
     */
    @Override
    public List<UmsResourceCategory> listAll() {
        return umsResourceCategoryMapper.selectList(null);
    }

    /**
     * 修改后台资源分类
     */
    @Override
    public void update(UmsResourceCategory umsResourceCategory) {
        umsResourceCategoryMapper.updateById(umsResourceCategory);
    }
}
